package org.ssssssss.script.functions;

import org.ssssssss.script.annotation.Comment;
import org.ssssssss.script.annotation.Function;

import java.lang.reflect.Array;

public class ArrayFunctions {

	@Function
	@Comment("创建`int`数组")
	public int[] new_int_array(int size) {
		return new int[size];
	}

	@Function
	@Comment("创建`double`数组")
	public double[] new_double_array(int size) {
		return new double[size];
	}

	@Function
	@Comment("创建`float`数组")
	public float[] new_float_array(int size) {
		return new float[size];
	}

	@Function
	@Comment("创建`byte`数组")
	public byte[] new_byte_array(int size) {
		return new byte[size];
	}

	@Function
	@Comment("创建`char`数组")
	public char[] new_char_array(int size) {
		return new char[size];
	}

	@Function
	@Comment("创建`boolean`数组")
	public boolean[] new_boolean_array(int size) {
		return new boolean[size];
	}

	@Function
	@Comment("创建`long`数组")
	public long[] new_long_array(int size) {
		return new long[size];
	}

	@Function
	@Comment("创建`Object`数组")
	public Object[] new_array(int size) {
		return new Object[size];
	}

	@Function
	@Comment("创建`Object`数组")
	public <T> T[] new_array(Class<T> componentType,int size) {
		return (T[]) Array.newInstance(componentType, size);
	}

	@Function
	@Comment("创建`String`数组")
	public String[] new_array(String ... array){
		return array;
	}

	@Function
	@Comment("创建`int`数组")
	public int[] new_array(int ... array){
		return array;
	}

	@Function
	@Comment("创建`double`数组")
	public double[] new_array(double ... array){
		return array;
	}

	@Function
	@Comment("创建`float`数组")
	public float[] new_array(float ... array){
		return array;
	}

	@Function
	@Comment("创建`char`数组")
	public char[] new_array(char ... array){
		return array;
	}

	@Function
	@Comment("创建`byte`数组")
	public byte[] new_array(byte ... array){
		return array;
	}

	@Function
	@Comment("创建`boolean`数组")
	public boolean[] new_array(boolean ... array){
		return array;
	}

	@Function
	@Comment("创建`long`数组")
	public long[] new_array(long ... array){
		return array;
	}

}
